package  
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class mainroom_playerslist_item extends MovieClip 
	{
		public var name_symb:TextField = new TextField();
		public var id:int;
		public var username:String;
		
		public function mainroom_playerslist_item(id:int, username:String) 
		{
			addEventListener(Event.ADDED_TO_STAGE, init);
			this.id = id;
			this.username = username;
			init_name_symb();
		}
		
		public function update_username(username:String):void 
		{
			this.username = username;
			init_name_symb();
		}
		
		private function init(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			addChild(name_symb);
		}
		
		private function init_name_symb():void 
		{
			name_symb.text = username;
			name_symb.setTextFormat(new TextFormat(null, 18));
			name_symb.width = 150;
		}
		
		public function destroy():void
		{
			if (parent)
				parent.removeChild(this);
		}
		
	}

}